// packageB/pages/search/search.js
// var pinyin= require("../../utils/dist/index");
const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    curValue: "",
    movies:[]
  },
  onLoad(){
    //初始化调用
    var movies = app.globalData.movieList;
    this.setData({movies});
  },
  setInput(e){
    //获取电影列表
    var allMovies = app.globalData.movieList;
    let curValue = e.detail;
    let movies = allMovies.filter(item=>item.nm.includes(curValue))
    this.setData({curValue,movies});
  },
  toPath(e){
    wx.navigateTo({
      url: '/pages/detailMovie/detailMovie?id='+e.currentTarget.dataset.id,
    })
  },   
  onShareAppMessage: function (res){
    return {
      title: '电影之家',
      path: '/pages/index/index'
    }
  },
})